// import TableFilterMixin from '@/mixins/TableFilterMixin'
import { Component, toNative } from 'vue-facing-decorator'
import {
    ProductTypeEnum,
} from '@/const/enum'
import { exportRecharge, getRechargeRecordList } from '@/api/company'
import type { AnyObject } from '@/types'
import type { RechargeDto } from '@/api/company/types'
import { PayWageView } from './Paywage'
import { downloadFile } from '@/utils/util'

@Component
export class ElesignView extends PayWageView {
    onLoadData(page: number, size: number, filters: AnyObject) {
        return getRechargeRecordList({
            productType: ProductTypeEnum.ELESIGN,
            pageNum: page,
            pageSize: size,
            ...filters
        })
    }

    async onExport() {
        const params = this.getFilters()
        const res = await exportRecharge({
            companyName: params.companyName,
            productType: ProductTypeEnum.ELESIGN,
            status: params.status
        })
        downloadFile(res)
    } 

    onToDetail(row: RechargeDto) {
        this.$router.push({
            path: `/customer/${row.companyId}`,
            query: {
                tab: 'elesign'
            }
        })
    }

    render() {
        return <div class="h-full">{super.render()}</div>
    }
}

export default toNative(ElesignView)
